import 'package:amap_flutter_location_example/choice.dart';
import 'package:amap_flutter_location_example/choice_enhance.dart';
import 'package:amap_flutter_location_example/location.dart';
import 'package:flutter/material.dart';

class Home extends StatefulWidget {
  // Home({Key key}) : super(key: key);

  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    var item = [Location(), Choice(), ChoiceEnhance()];
    var title = ['显示我的位置', '地图选点', '地图选点（增强）'];
    return Scaffold(
      appBar: AppBar(
        title: Text('demo list'),
      ),
      body: ListView.builder(
        itemCount: item.length,
        itemBuilder: (context, index) {
          // return item[index];
          return ListTile(
            title: Text('${title[index]}'),
            onTap: () {
              Navigator.of(context).push(MaterialPageRoute(builder: (context) {
                return item[index];
              }));
            },
          );
        },
      ),
    );
  }
}
